<template>
<div>
    <Form :model="formCustom" :label-width="80"> 
        <FormItem label="学校名称" prop="name">
            <Input type="text" v-model="formCustom.name" ></Input>
        </FormItem>
        <FormItem>
            <Button type="primary" @click="handleSubmit">Submit</Button>
        </FormItem>
    </Form>
</div>
</template>
<script>
    import util from '../libs/util';
    export default {

        created() {
        },
        
        data () {
            return {
                formCustom: {
                    name: "",
                    status: 1
                },
            }
        },
        methods: {
            handleSubmit () {
                //this.formCustom.head = "zjl",
                this.$http.post(util.baseURL+"school/addSchool",this.formCustom,
                    {emulateJSON: true})
                    .then(
                        (response)=>{
                            if(response.data.data) {
                               this.$Message.info(response.data.msg);
                               this.$router.push("/index/schoolList");
                               this.formCustom = {};
                               return;
                            } else {
                               this.$Message.error("添加失败！");
                            }
                        },
                        (error)=>{
                            this.$Message.error("添加失败！");
                        }
                );
            }, 
        }
    }
</script>